1. Field of the Invention
The present invention relates to a moving picture coding method, a moving picture decoding method, a moving picture coding apparatus, a moving picture decoding apparatus for coding/decoding a moving picture, using either a frame structure or a field structure, and a program for executing these methods in software.
2. Background of the Related Art
In coding of a moving picture, compression of information of a volume is usually performed by eliminating redundancy both in spatial and temporal directions of the moving picture. Here, inter-picture prediction coding is employed as a method of eliminating the redundancy in the temporal direction. The inter-picture prediction coding uses a previous picture or a subsequent picture to a current picture to be coded in a display order as a reference picture when a picture is coded. Then, a motion is estimated using the reference pictures, and the information volume is compressed by removing the redundancy in the spatial direction for a differential value between a picture, to which motion compensation is performed, and the current picture.
In the moving picture coding method called H. 264 which is under the process of standardization, a picture for which intra-picture prediction coding is performed using only a current picture to be coded without reference pictures is called I-picture. A picture here means a unit of coding including both a frame and a field. A picture for which the inter-picture prediction coding is performed with reference to a single picture that is already coded is called P-picture whereas a picture for which the inter-picture prediction coding is performed referring simultaneously to two pictures that are already coded is called B-picture.
FIG. 1 is a pattern diagram showing a prediction relation of each picture in the moving picture coding method mentioned above. The vertical line in FIG. 1 represents a single picture, and its picture type (I, P and B) is indicated in the lower right-hand corner of each of the pictures. The arrows in the diagram indicate that the inter-picture prediction coding is performed as follows: the picture located at the starting edge of the arrow refers to the picture located at the ending edge of the arrow as a reference picture. For example, B-picture located secondly from the head is coded using the I-picture located in the head and the P-picture located fourthly from the head as reference pictures.
Under the H. 264 method, a coding mode called direct mode can be selected in the coding of B-pictures. The direct mode provides two types of methods: a temporal method and a spatial method. In the temporal direct mode, the current block itself does not have motion vectors and motion vectors used for the current block are estimated and generated by performing scaling processing based on a location relation according to display time between the pictures, considering the motion vector of other picture that is already coded as a reference motion vector. (See reference, for example, Japanese Laid-Open Patent Application No. H11-75191).
FIG. 2 is a pattern diagram showing a method of estimating and generating motion vectors in the temporal direct mode. P represents P-picture whereas B represents B-picture and the numbers put on the picture types indicate a display order of each of the pictures. Each of the pictures P1, B2, B3 and P4 respectively includes display order information T1, T2, T3 and T4. Here, a case of coding a block BL0 in the picture B3 shown in FIG. 2 in the temporal direct mode is illustrated.
In this case, a motion vector MV1 in a block BL1, co-locating with the block BL0 in the picture P4 that is already coded and located closely to the picture B3 in display order, is used. The motion vector MV1 is used for coding the block BL1 and refers to the picture P1. In this case, the motion vectors used for coding the block BL0 are as follows: a motion vector MV_F with respect to the picture P1 and a motion vector MV_B with respect to the picture P4. Assuming that the value of the motion vector MV1 is MV, the value of the MV_F is MVf and the value of the motion vector MV_B is MVb, the MVf and the MVb can be obtained using respective equations 1a and 1b shown below.MVf=(T3−T1)/(T4−T1)×MV  (Equation 1a)MVb=(T3−T4)/(T4−T1)×MV  (Equation 1b)
The motion compensation is thus performed for the block BL0 based on the reference pictures P1 and P4, using the motion vectors MV_F and the MV_B obtained by performing scaling processing for the motion vector MV1.
On the other hand, in the spatial direct mode, the current block itself does not have motion vectors, as is the case of temporal direct mode, and the motion vectors of the coded blocks spatially neighboring the current block are used for reference in the coding.
FIG. 3 is a pattern diagram showing a method of estimating and generating the motion vectors in the spatial direct mode. P represents P-picture whereas B represents B-picture, and the numbers put on the picture types indicate the display order of each of the pictures. Here, a case of coding the block BL0 in the picture B3 shown in FIG. 3 in the spatial direct mode is illustrated.
In this case, the motion vectors having referred to the coded pictures that are located in the positions closest to the current block in display order, out of respective motion vectors MVA1, MVB1 and MVC1 of the coded blocks respectively including one of three pixels A, B and C that are located closely to the current block BL0, are determined as candidates for a motion vector of the current block. When three motion vectors are determined as candidates, a medium value of the three values is obtained as a motion vector for the current block. When two motion vectors are determined as candidates, an average value of the two values is obtained as a motion vector for the current block. When only one motion vector is determined as a candidate, the determined motion vector is obtained as a motion vector for the current block. In the example shown in FIG. 3, the motion vectors MVA1 and MVC1 are obtained with reference to the picture P2 whereas the motion vector MVB1 is obtained with reference to the picture P1. Therefore, the average value of the motion vectors MVA1 and MVC1, referring to the picture P2 that is already coded and located in a position closest to the current picture in display order, is obtained as the first motion vector for the current block, MV_F. The same applies when the second motion vector MV_B is obtained.
In the coding method of the H. 264, in the case of a progressive picture, one picture is frame coded as a frame and furthermore, one picture is allowed to be field coded as separate two fields, a top field and a bottom field, as in the case of interlaced picture.
FIGS. 4A and 4B are pattern diagrams showing display order information assigned for the field of the interlaced picture and the progressive picture. Two vertical lines respectively having the same frame number represent that they are fields. For the interlaced picture, the display order information is assigned so that the top field and the bottom field are at regular intervals as shown in FIG. 4A. For the progressive picture, it is defined that two fields can represent an exact relation in display order by having the same display order information as shown in FIG. 4B. In the following description, a picture with two fields belonging to the same frame and having the same display order information is called a progressive picture, otherwise, called an interlaced picture. However, the case is not limited to this and any picture can have two fields belonging to the same frame and having the same display order information.
When the field coding is performed for the interlaced picture and the progressive picture, and the temporal direct mode is selected, the scaling of the motion vector is performed using the method explained in the Background Art as well as the display order information assigned for each field. Here, there is a case in which the two reference pictures are a top field and a bottom field belonging to the same frame. The following describes the respective cases of field coding the interlaced picture and the progressive picture.
FIG. 5 is a pattern diagram showing a method of estimating and generating the motion vectors in temporal direct mode in the case of the interlaced picture. P represents P-picture whereas B represents B-picture, and the numbers put on the picture types represent display order of each of the pictures. Here, a case of field coding the block BL0 in the picture B2 shown in FIG. 5 in the temporal direct mode is described.
In this case, a motion vector MV1 of the block BL1, co-locating with the block BL0 in the picture P3 that is a backward reference picture of the picture B2, is used. The motion vector MV1 is a motion vector used for coding the block BL1 and refers to a top field of the same picture P3. The motion vectors MV_F and MV_B used for coding the block BL0 can be obtained as shown below, using the equations 1a and 1b described above.MVf=(4−5)/(6−5)×MV=−MVMVb=(4−6)/(6−5)×MV=−2MV
FIG. 6 is a pattern diagram showing a method of estimating and generating the motion vectors in temporal direct mode for a progressive picture. P represents a P-picture whereas B represents a B-picture, and the numbers put on the picture types indicate display order of each of the pictures. Here, the case of field coding the block BL0 in the picture B2 shown in FIG. 6 in the temporal direct mode is described.
In this case, the motion vector MV1 of the block BL1, co-locating with the block BL0 in the picture P3 that is a backward reference picture of the picture B2, is used. The motion vector MV1 is a motion vector used for coding the block BL1 and refers to a top field of the same picture P3. In this case, the motion vectors MV_F and MV_B used for coding the block BL0 cannot be obtained since the denominators indicate 0 in the equations 1a and 1b above.MVf=(3−5)/(5−5)×MV operation is not allowedMVb=(3−5)/(5−5)×MV operation is not allowed
Thus, when the field coding is performed for the progressive picture, the motion vectors cannot be generated by performing the scaling processing in the case where temporal direct mode is selected and the two reference pictures are the top field and the bottom field belonging to the same frame.
Similarly, when the field coding is performed for the interlaced picture and the progressive picture, and the spatial direct mode is selected, a motion vector referring to the coded picture that is located in a position closest to the current picture in display order is determined as a candidate for a motion vector of the current block, using the display order information assigned for each field. Here, there is a case that the pictures referred to by the motion vectors can be a top field and a bottom field belonging to the same frame.
FIG. 7 is a pattern diagram showing a method of estimating and generating the motion vectors in the spatial direct mode for a progressive picture. P represents a P-picture and B represents a B-picture whereas the numbers put on the picture types indicate display order of each of the pictures and T represents a top field while B represents a bottom field. Here, the case of field coding the block BL0 in the picture B3_T shown in FIG. 7 in the spatial direct mode is illustrated.
In this case, respective motion vectors MVA1, MVB1 and MVC1 of the coded blocks which respectively include one of three pixels of A, B and C, that are located closely to the current block BL0, refer respectively to the fields P2_T, P1_B and P2_B. The fields P2_T and P2_B have the same display order information since they are the top field and the bottom field belonging to the same frame. Therefore, it is impossible to specify which of the fields P2_T and P2_B is located in a position closest to the current block in display order. Consequently, the motion vectors can neither be estimated nor generated for the current block.